import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import TreeTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// 导入富文本编辑器对应的样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'



// 配置请求的根路径在api接口文档中有地址
axios.defaults.baseURL = '/api'
//在request 拦截器中，展示进度条

//设置axios拦截器 就是axios请求预处理
axios.interceptors.request.use(config =>{
	NProgress.start()
	return config
})
axios.interceptors.response.use(config =>{
	NProgress.done()
	return config
})
// 每一个vue实例都可以直接通过this.$http使用axios
// 在reponse 拦截器，隐藏进度条
Vue.prototype.$http = axios
// 富文本编辑器注册全局
Vue.use(VueQuillEditor)

// 日期过滤器
Vue.filter('dateFormat',function(originval){
	const dt=new Date(originval)
	const y=dt.getFullYear()
	const m=(dt.getMonth()+1+ '').padStart(2,0)
	const d=(dt.getDate() +'').padStart(2,0)
	const hh=(dt.getHours() +'').padStart(2,0)
	const mm=(dt.getMinutes() +'').padStart(2,0)
	const ss=(dt.getSeconds() +'').padStart(2,0)
	return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

Vue.config.productionTip = false

Vue.component('tree-table',TreeTable)
new Vue({
	router,
	store,
	render: h => h(App)
}).$mount('#app')
